Ccay.Module.define("Ccay.example.ui.suggest",function(page,$S){
	
	page.ready=function(){
		$("#suggestDemo").ccayTab();
		
		var conf ={
			url: "services/ccay/demo/student/list/page/80/1",
			fieldMapper: {
				name: $i18n("名称"),
				age: $i18n("年龄")
			},
			valueField:"id",
            displayField: "name"
		};
		$("#suggest").ccaySuggest(conf);
		    
		//---------------
		var conf12 ={
				url: "services/ccay/demo/student/list/page/80/1",
				fieldMapper: {
					name: $i18n("名称"),
					age: $i18n("年龄")
				},
				valueField:"id",
	            displayField: "name",
	            historySupport:false
			};
			$("#suggest12").ccaySuggest(conf12);
			

			//---------------
			var conf112 ={
					url: "services/ccay/demo/student/list/page/80/1",
					fieldMapper: {
						name: $i18n("名称"),
						age: $i18n("年龄")
					},
					valueField:"id",
		            displayField: "name",
		            isFocusOutSelector:true
				};
				$("#suggest112").ccaySuggest(conf112);
							
		//---------------
		
		var conf2 ={
				url: "services/ccay/demo/student/list/page/80/1",
				fieldMapper: {
					name: $i18n("名称"),
					age: $i18n("年龄")
				},

				multi :true,	
				valueField:"id",
	            displayField: "name",
	            getTextAjax:{type:"GET",url:"",setAjax:function(ajax,ui){
	            	ajax.url="services/xxx//{0}".formatValue(ajax.data[0]);
	            }}
		};
		$("#suggest2").ccaySuggest(conf2);

		$('#sgt').suggestion({
			item: "<li class='{0}' val='${cityId}'><span><font class='list-text'>${cityId}:${cityName}</font> - ${provinceId}</span></li>",
			defaultFilter:'%',
			suggestNum:20,
			ajax:{
		   	 	url:"services/ccay/demo/address/listCities/page/${suggestNum}/1?cityName={0}"
		    }});
		    
		
		 $('#suggest_trigger1').ccaySuggest({
	  		valueField:"provinceId",
	  		displayField:'provinceName',
	  		fieldMapper: {
	  			provinceName: $i18n("省份")
			},
	  	    url:"services/ccay/demo/address/listProvinces/page/80/1"
	  	 });
	  	     
	     $('#suggest_link1').ccaySuggest({
	 		valueField:"cityId",
	 		displayField:'cityName',
	 		fieldMapper: {
	 			cityName: $i18n("城市")
			},
	 		ajax:{
	 	   	 	url:"services/ccay/demo/address/listCities/page/80/1?${connect}"
	 	    },
	 	    connector:[
	 	 				{target:"#suggest_trigger1",paramName:"provinceId",defaultValue:""}
	 		]
	 		});
	};

})